package com.ztools.wx.controller;

import com.ztools.common.util.common.Result;
import com.ztools.wx.service.WxMemberService;
import me.chanjar.weixin.mp.bean.result.WxMpUser;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Author:seeTools
 * @Date: 2023/4/15  15:09
 * @Version 1.0
 */
@RestController
@RequestMapping("wx/user")
public class WxUserController {

    @Resource
    private WxMemberService wxMemberService;

    @RequestMapping("/info/{openid}")
    public Result getUserInfo(@PathVariable String openid) {
        WxMpUser memberInfo = wxMemberService.getUserInfo(openid);
        if (memberInfo == null) {
            return Result.error("获取不到该粉丝");
        }
        return Result.success("获取成功").data(memberInfo);
    }


}
